package top.aicats.pattern.singleton.threadLocalSingleton;

public class ThreadLocalSingleton {
    private ThreadLocalSingleton(){}
    private static final ThreadLocal<ThreadLocalSingleton> threadLocal = new ThreadLocal<ThreadLocalSingleton>() {
        @Override
        protected ThreadLocalSingleton initialValue() {
            return new ThreadLocalSingleton();
        }
    };

    public static  ThreadLocalSingleton getInstance() {
        return threadLocal.get();
    }
}
